import axios from "axios";
// import store from "./store";
// import { createRouter, createWebHistory, RouteRecordRaw, createWebHashHistory } from 'vue-router'
let localhostPath = process.env.VUE_APP_BASEURL;


const service = axios.create({
  baseURL: localhostPath,
  headers: {
    "Content-Type": "application/json;charset=UTF-8",
    // Authorization: String(store.state.Authorization),
  },
});

// request拦截器
service.interceptors.request.use(
  (config) => {
    return config;
  },
  (error) => {
    Promise.reject(error);
  }
);

// response 拦截器
service.interceptors.response.use(
  (response) => {
    /**
     * code为非20000是抛错 可结合自己业务进行修改
     */
    if (response.data.code == 200) {
    }
    return response;
  },
  (error) => {
    return Promise.reject(error);
  }
);

export default service;
